public class note4 {
    public static int factorial(int n){
        int sum=0;
        for(int i=1; i<=n;i++){
            int ret=1;
            for(int j=1;j<=i;j++){
                ret*=j;
            }
            sum+=ret;
        }
        return sum;
    }
    public static void main(String[] args) {
        int facNum=factorial(3);
        System.out.println(facNum);
    }
}
